package org.csu.mypetstore.service;

import org.csu.mypetstore.domain.Account;
import org.csu.mypetstore.persistence.AccountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountService {
    @Autowired
    private AccountMapper accountMapper;

    public List<Account> getAccountList() {
        return accountMapper.getAccountList();
    }
    public Account getAccountByUserid(String userId) {return accountMapper.getAccountByUserid(userId);}
    public void newAcount(Account account){accountMapper.newAccount(account);}
    public void newSignon(Account account){accountMapper.newSignon(account);}
    public void newProfile(Account account){accountMapper.newProfile(account);}
    public List<Account> searchAccountList(String keyword) {
        return accountMapper.searchAccountList("%" + keyword.toLowerCase() + "%");
    }
    public void updateAccount (Account account) {accountMapper.updateAccount(account);};
    public void updateSignon (Account account){accountMapper.updateSignon(account);};
    public void updateSignonNoPsw(Account account){accountMapper.updateSignonNoPsw(account);}
    public void updateProfile (Account account){accountMapper.updateProfile(account);}
    public void updateOrders (Account account){accountMapper.updateOrders(account);}
    public void deleteAccount (String userId){accountMapper.deleteAccount(userId);};
    public void deleteSignon (String userId){accountMapper.deleteSignon(userId);};
    public void deleteProfile (String userId){accountMapper.deleteProfile(userId);};

}
